import service from '@/utils/axios'

export const GET_PORT_LIST = () => {
  return service({
    url: '/staff/portList',
    method: 'get'
  })
}
export interface IPort {
  name: string
  num: number
  charge: string
  job: string
  tel: string
  id?: string
}
export const ADD_PORT = (data: IPort) => {
  return service({
    url: '/staff/portAdd',
    method: 'post',
    data
  })
}

export const DELETE_PORT = (id: string) => {
  return service({
    url: '/staff/portDel',
    method: 'get',
    params: {
      id
    }
  })
}
export const EDIT_PORT = (data: IPort) => {
  return service({
    url: '/staff/portEdit',
    method: 'post',
    data
  })
}
export const GET_PORT_DETAIL = (id: string) => {
  return service({
    url: '/staff/portSearch',
    method: 'get',
    params: {
      id
    }
  })
}
export const GET_PORT_VIEW = (id: string) => {
  console.log(id)
  return service({
    url: `/getViewAuthByPortId/${id}`,
    method: 'get'
  })
}

export const ADD_PORT_VIEW = ({ id, ...data }: { [key: string]: string }) => {
  return service({
    url: `/setViewAuthByPortList/${id}`,
    method: 'post',
    data
  })
}
